import { request, formRequest } from '../utils/request';

export async function fetchRecommList(params) {
  return request('adminapi/admin/getSappRecommPageList', {
    method: 'POST',
    body: params,
  });
}

export async function changeSts(params) {
  return request('adminapi/admin/setSappRecommPageSts', {
    method: 'POST',
    body: params,
  });
}

export async function addRecommPage(params) {
  return request('adminapi/admin/addSappRecommPage', {
    method: 'POST',
    body: params,
  });
}


export async function deletePadRecomm(params) {
  return request('adminapi/admin/delSappRecommPage', {
    method: 'POST',
    body: params,
  });
}

export async function fetchRecommPage(params) {
  return request('adminapi/admin/getSappRecommPage', {
    method: 'POST',
    body: params,
  });
}

export async function fetch(params) {
  return request('adminapi/admin/getAppRecommPageByChannel', {
    method: 'POST',
    body: params,
  });
}

export async function addRecommPageLayout(params) {
  return request('adminapi/admin/addSappRecommLayout', {
    method: 'POST',
    body: params,
  });
}

export async function editPageLayout(params) {
  console.log('编辑layoutList', params.layoutList)
  return request('adminapi/admin/updateSappRecommPage', {
    method: 'POST',
    body: params,
  });
}

export async function deletePageLayout(params) {
  return request('adminapi/admin/delSappRecommLayout', {
    method: 'POST',
    body: params,
  });
}

export async function fetchLayoutDetail(params) {
  return request('adminapi/admin/getSappRecommDetailList', {
    method: 'POST',
    body: params,
  });
}

export async function addLayoutDetail(params) {
  let file = params.name;
  delete params.name;
  delete params.goodsName;

  return formRequest('adminapi/admin/upload/addSappRecommDetail', {
    method: 'POST',
    body: params,
  },
    file
  );
}

export async function editLayoutDetail(params) {
  let file = params.name;
  delete params.name;
  delete params.goodsName;

  return formRequest('adminapi/admin/upload/setSappRecommDetail', {
    method: 'POST',
    body: params,
  },
    file
  );
}


export async function fetchAdv(params) {
  return request('adminapi/admin/getAdvDetail', {
    method: 'POST',
    body: params,
  });
}

export async function addAdv(params) {
  return request('adminapi/admin/addAdvInfo', {
    method: 'POST',
    body: params,
  });
}

export async function editAdv(params) {
  return request('adminapi/admin/setAdvInfo', {
    method: 'POST',
    body: params,
  });
}


export async function addAdvDetail(params) {
  let file = params.name;
  delete params.name;
  delete params.goodsName;

  return formRequest('adminapi/admin/upload/addAdvDetail', {
    method: 'POST',
    body: params,
  },
    file
  );
}

export async function editAdvDetail(params) {
  let file = params.name;
  delete params.name;
  delete params.goodsName;

  return formRequest('adminapi/admin/upload/setAdvDetail', {
    method: 'POST',
    body: params,
  },
    file
  );
}

export async function update(params) {
  return request('adminapi/admin/updateSappRecommChannel', {
    method: 'POST',
    body: params,
  });
}

export async function add(params) {
  return request('adminapi/admin/addSappRecommChannel', {
    method: 'POST',
    body: params,
  });
}

export async function del(params) {
  return request('adminapi/admin/delSappRecommChannel', {
    method: 'POST',
    body: params,
  });
}








